home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
asmutil
/
asm_n_z.zip
/
SPRITES1.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-05-27
|
23KB
|
541 lines
;
; *** Listing 1 ***
;
;This program demonstrates the use of a set of routines which
; allow smooth, non-flickering, and non-destructive animation
; of objects on an IBM CGA or EGA graphics adapter. The program
; moves two helicopters and a balloon along programmed paths while
; internally animating the helicopter's roters, and orientation. You
; will see no undesirable fringe or overlap effects. Objects look
; as if they are in separate planes, and blank areas within an object
; such as the windows of the helicopters appear to be transparent.
;
; Link with Listings 2 and 3 with the command:
; link sprites1+sprites2+sprites3;
; to generate the executable sprite application file sprites1.exe.
;
stack segment para stack 'STACK'
db 100 dup('Stack')
stack ends
;
;Segment used to hold memory image of the background. It is used to
; restore the background before an object is moved.
;
background_segment segment para 'DATA'
db 4000h-((4000h-16000)/2) dup(0) ;last 192 bytes of the
background_segment ends ; 16K video memory
; ; buffer are never used
cseg segment para public 'cseg'
assume cs:cseg,ds:cseg,es:nothing
extrn byte_move_form_driver:near
extrn initialize:near,terminate:near,object_services:near
extrn vert_int_modulo_count:word
extrn put_objects_on_screen:far
;
;The flag below must be set properly before assembling this program
;
ega equ 0 ;1 to assemble for use on an Enhanced Graphics Adapter
;0 to assemble for use on a Color Graphics Adapter
cga equ (ega xor 1) ;the opposite status of ega
;
if ega
old_vert_count dw 0 ;holds number used to synchronize this
; program to vertical interrupt
endif
;
screen_buffer_adr equ 0b800h ;video mode 4's buffer
; paragraph address
;
num_objects equ 3 ;this program will move three objects
;
;Below is a table which holds all the parameters which govern the
; movement of the three individual objects
x dw 15, 38, 64
y dw 90, 180, 164
xinc dw 1, 0, -1
yinc dw 0, -2, 0
form dw bcptr_rt_tbl, balloon_tbl, rcptr_lft_tbl
formbase dw bcptr_rt_tbl, balloon_tbl, rcptr_lft_tbl
formmax dw bcptr_rt_tbl_max, balloon_tbl_max, rcptr_lft_tbl_max
control dw copter1_cinit, balloon_cinit, copter0_cinit
controlbase dw copter1_control, balloon_control, copter0_control
controlmax dw copter1_cntl_max, balloon_cntl_max, copter0_cntl_max
delay dw 01, 01, 01
delaybase dw 04, 12, 06
repeat dw 47, 91, 55
;
;Below are lists of parameters which control the sequence of
; parameters used to define the movement patterns, and shapes.
; The parameters are listed in the following order:
; xinc, yinc, form, formmax, delay, repeat
;
copter0_control dw -1,0
dw rcptr_lft_tbl,rcptr_lft_tbl_max,06,54
copter0_cinit dw 0,-2
dw rcptr_lft_tbl,rcptr_lft_tbl_max,06,35
dw 1,0
dw rcptr_rt_tbl,rcptr_rt_tbl_max,06,4
dw 1,2
dw rcptr_rt_tbl,rcptr_rt_tbl_max,08,10
dw 1,-2
dw rcptr_rt_tbl,rcptr_rt_tbl_max,08,8
dw 1,-2
dw rcptr_rt_tbl,rcptr_rt_tbl_max,08,4
dw 0,0
dw rcptr_rt_tbl,rcptr_rt_tbl_max,10,10
dw 1,-2
dw rcptr_rt_tbl,rcptr_rt_tbl_max,08,4
dw 1,-2
dw rcptr_rt_tbl,rcptr_rt_tbl_max,08,9
dw 1,2
dw rcptr_rt_tbl,rcptr_rt_tbl_max,08,15
dw 0,2
dw rcptr_rt_tbl,rcptr_rt_tbl_max,10,35
copter0_cntl_max label byte
;
copter1_control dw 1,0
dw bcptr_rt_tbl,bcptr_rt_tbl_max,04,46
copter1_cinit dw -1,0
dw bcptr_lft_tbl,bcptr_lft_tbl_max,04,46
dw 1,0
dw bcptr_rt_tbl,bcptr_rt_tbl_max,04,46
dw -1,0
dw bcptr_lft_tbl,bcptr_lft_tbl_max,04,46
dw 0,0
dw disappear_table,disappear_table_max,300,1
copter1_cntl_max label byte
;
balloon_control dw 0,-2
dw balloon_tbl,balloon_tbl_max,12,70
balloon_cinit dw 0,2
dw balloon_tbl,balloon_tbl_max,12,70
balloon_cntl_max label byte
;
;Below are tables used to sequence the internal animation
;
rcptr_lft_tbl label word
dw rcopter_left0
dw rcopter_left1
rcptr_lft_tbl_max label word
;
rcptr_rt_tbl label word
dw rcopter_right0
dw rcopter_right1
rcptr_rt_tbl_max label word
;
bcptr_lft_tbl label word
dw bcopter_left0
dw bcopter_left1
bcptr_lft_tbl_max label word
;
bcptr_rt_tbl label word
dw bcopter_right0
dw bcopter_right1
bcptr_rt_tbl_max label word
;
balloon_tbl label word
dw balloon
balloon_tbl_max label word
;
disappear_table label word
dw 0ffffh
disappear_table_max label word
;
;Below are the forms used to define the various images of the objects
; in a form suitable for an AND-OR type form driver. The format is:
; byte 0 - height in lines (h)
; byte 1 - width in bytes (w)
; followed by w X h (mask word, image word) pairs.
;
rcopter_left0 label byte
DB 00Eh, 006h, 000h, 000h, 0FFh, 0FFh, 000h, 00Fh, 0FFh, 0F0h
DB 0FFh, 0FFh, 000h, 000h, 0FFh, 0F0h, 000h, 00Fh, 000h, 00Fh
DB 0FFh, 0F0h, 0FFh, 0FFh, 000h, 000h, 0FFh, 0F0h, 000h, 00Fh
DB 0FFh, 0FFh, 000h, 000h, 0FFh, 0FFh, 000h, 000h, 0FCh, 000h
DB 002h, 0AAh, 003h, 0FFh, 0A8h, 000h, 0FFh, 0FFh, 000h, 000h
DB 0F3h, 0FFh, 008h, 000h, 0C0h, 0FFh, 02Ah, 000h, 0FFh, 03Fh
DB 000h, 0C0h, 0CFh, 0FFh, 020h, 000h, 0F0h, 03Fh, 00Ah, 080h
DB 0FFh, 03Fh, 000h, 0C0h, 03Fh, 0FFh, 080h, 000h, 0F0h, 00Ch
DB 00Ah, 0A2h, 03Fh, 03Fh, 080h, 0C0h, 03Fh, 0FFh, 080h, 000h
DB 0F0h, 003h, 00Ah, 0A8h, 0C0h, 000h, 03Fh, 0FFh, 03Fh, 0FFh
DB 080h, 000h, 0C0h, 00Ch, 02Ah, 0A2h, 03Fh, 03Fh, 080h, 0C0h
DB 000h, 000h, 0AAh, 0AAh, 000h, 03Fh, 0AAh, 080h, 0FFh, 03Fh
DB 000h, 0C0h, 0C0h, 000h, 02Ah, 0AAh, 000h, 0FFh, 0AAh, 000h
DB 0FFh, 03Fh, 000h, 0C0h, 0F0h, 000h, 00Ah, 0AAh, 003h, 0FFh
DB 0A8h, 000h, 0FFh, 0FFh, 000h, 000h, 03Ch, 0FFh, 0C3h, 000h
DB 0CFh, 03Fh, 030h, 0C0h, 0FFh, 0FFh, 000h, 000h, 0C0h, 000h
DB 03Fh, 0FFh, 000h, 0FFh, 0FFh, 000h, 0FFh, 0FFh, 000h, 000h
rcopter_left1 label byte
DB 00Eh, 006h, 000h, 000h, 0FFh, 0FFh, 000h, 00Fh, 0FFh, 0F0h
DB 0FFh, 0FFh, 000h, 000h, 000h, 000h, 0FFh, 0FFh, 0FFh, 0FFh
DB 000h, 000h, 0FFh, 0FFh, 000h, 000h, 0FFh, 0F0h, 000h, 00Fh
DB 0FFh, 0FFh, 000h, 000h, 0FFh, 0FFh, 000h, 000h, 0FCh, 000h
DB 002h, 0AAh, 003h, 0FFh, 0A8h, 000h, 0FFh, 0FFh, 000h, 000h
DB 0F3h, 0FFh, 008h, 000h, 0C0h, 0FFh, 02Ah, 000h, 0FFh, 0FFh
DB 000h, 000h, 0CFh, 0FFh, 020h, 000h, 0F0h, 03Fh, 00Ah, 080h
DB 0F3h, 0F3h, 00Ch, 00Ch, 03Fh, 0FFh, 080h, 000h, 0F0h, 00Ch
DB 00Ah, 0A2h, 03Ch, 0CFh, 083h, 030h, 03Fh, 0FFh, 080h, 000h
DB 0F0h, 003h, 00Ah, 0A8h, 0C0h, 03Fh, 02Ah, 0C0h, 03Fh, 0FFh
DB 080h, 000h, 0C0h, 00Ch, 02Ah, 0A2h, 03Ch, 0CFh, 083h, 030h
DB 000h, 000h, 0AAh, 0AAh, 000h, 03Fh, 0AAh, 080h, 0F3h, 0F3h
DB 00Ch, 00Ch, 0C0h, 000h, 02Ah, 0AAh, 000h, 0FFh, 0AAh, 000h
DB 0FFh, 0FFh, 000h, 000h, 0F0h, 000h, 00Ah, 0AAh, 003h, 0FFh
DB 0A8h, 000h, 0FFh, 0FFh, 000h, 000h, 03Ch, 0FFh, 0C3h, 000h
DB 0CFh, 03Fh, 030h, 0C0h, 0FFh, 0FFh, 000h, 000h, 0C0h, 000h
DB 03Fh, 0FFh, 000h, 0FFh, 0FFh, 000h, 0FFh, 0FFh, 000h, 000h
rcopter_right0 label byte
DB 00Eh, 006h, 0FFh, 0FFh, 000h, 000h, 0F0h, 000h, 00Fh, 0FFh
DB 000h, 000h, 0FFh, 0FFh, 0FFh, 0FFh, 000h, 000h, 0FFh, 0FFh
DB 000h, 000h, 000h, 000h, 0FFh, 0FFh, 0FFh, 0FFh, 000h, 000h
DB 0FFh, 0FFh, 000h, 000h, 00Fh, 0FFh, 0F0h, 000h, 0FFh, 0FFh
DB 000h, 000h, 0FFh, 0C0h, 000h, 02Ah, 000h, 03Fh, 0AAh, 080h
DB 0FCh, 0FFh, 003h, 000h, 0FFh, 003h, 000h, 0A8h, 0FFh, 0CFh
DB 000h, 020h, 0FCh, 0FFh, 003h, 000h, 0FCh, 00Fh, 002h, 0A0h
DB 0FFh, 0F3h, 000h, 008h, 0FCh, 0FCh, 003h, 002h, 030h, 00Fh
DB 08Ah, 0A0h, 0FFh, 0FCh, 000h, 002h, 000h, 003h, 0FFh, 0FCh
DB 0C0h, 00Fh, 02Ah, 0A0h, 0FFh, 0FCh, 000h, 002h, 0FCh, 0FCh
DB 003h, 002h, 030h, 003h, 08Ah, 0A8h, 0FFh, 0FCh, 000h, 002h
DB 0FCh, 0FFh, 003h, 000h, 0FCh, 000h, 002h, 0AAh, 000h, 000h
DB 0AAh, 0AAh, 0FCh, 0FFh, 003h, 000h, 0FFh, 000h, 000h, 0AAh
DB 000h, 003h, 0AAh, 0A8h, 0FFh, 0FFh, 000h, 000h, 0FFh, 0C0h
DB 000h, 02Ah, 000h, 00Fh, 0AAh, 0A0h, 0FFh, 0FFh, 000h, 000h
DB 0FCh